#include <iostream>
#include <cstring>
using namespace std;

class String 
{
	private : 
		char *m_p;
	public :
		String(const char *str = NULL);
		~String();
		String(const String& other);
		void get_str(void);
	protected :
};

String :: String(const char *str)
{
	if(NULL == str)
	{
		m_p = new char[1];
		*m_p = '\0';
	}
	else
	{
		m_p = new char[strlen(str) + 1];
		strcpy(m_p, str);
	}
}

String :: String(const String& other)
{
	m_p = new char[strlen(other.m_p) + 1];
	strcpy(m_p, other.m_p);
	cout << "String copy()" << endl << endl;
}

String :: ~String()
{
	delete [] m_p;
	cout << "Destruction ~String()" << endl << endl;
}

void String :: get_str(void)
{
	cout << m_p << endl;
}


int main()
{
	String s1;
	String s2("hjj");
	String s3(s2);

	s1.get_str();
	s2.get_str();
	s3.get_str();

	cout << endl;
}
